﻿namespace BM.Tools.WebControls.MForm.Controls
{    
    using System.Xml.XPath;

    using Validators;

    /// <summary>
    /// An interface for webcontrols that want to be used in the MForm framework 
    /// </summary>
    public interface IXmlEditor
    {
        /// <summary>
        /// Gets a value indicating whether XmlEdit is enabled.
        /// if enabled, this control will be used to generate the xml output
        /// </summary>
        /// <value>
        /// The xml edit enabled.
        /// </value>
        bool XmlEditEnabled
        {
            get;
        }

        /// <summary>
        /// Gets a value indicating what is the ordinal number of the current xml edited fragment.
        /// </summary>
        int Ordinal
        {
            get;
        }

        /// <summary>
        /// Appends the specified xml node to the parent node
        /// </summary>
        /// <param name="parent">
        /// The parent.
        /// </param>
        void AppendToParent(IXPathNavigable parent);

        /// <summary>
        /// perfors data validation on this control
        /// </summary>
        /// <param name="validator">
        /// The validator.
        /// </param>
        /// <returns>
        /// is the data in this control valid
        /// </returns>
        bool Validate(RootValidator validator);
    }
}